package com.iflytek.springboot_medicine.mapper;

import com.iflytek.springboot_medicine.entity.DingDanOrder;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DingDanOrdersMapper {

    @Select("SELECT * FROM orders WHERE user_name = #{userName}")
    List<DingDanOrder> selectOrdersByName(@Param("userName") String userName);

    @Select("SELECT * FROM orders")
    List<DingDanOrder> selectAllOrders();
    
    @Select("SELECT COUNT(*) FROM orders WHERE user_name = #{userName}")
    int countOrdersByName(@Param("userName") String userName);
}
